#ifndef __FLOPPY__
#define __FLOPPY__

#define _4KB 0x1000

#ifndef TRUE
#define TRUE  1
#endif

#ifndef FALSE
#define FALSE 0
#endif

#define NO_FLOPPY 0x0
#define FLOPPY_5_1_4_360KB 0x1
#define FLOPPY_5_1_4_1_2MB 0x2
#define FLOPPY_3_1_2_720KB 0x3
#define FLOPPY_3_1_2_1_4MB	0x4

#define FLOPPY_MAIN_STATUS_REGISTER            0x4
#define FLOPPY_FIFO_DATA_REGISTER              0x5
#define FLOPPY_DIGITAL_OUTPUT_REGISTER         0x2
#define FLOPPY_CONFIGURATION_CONTROL_REGIGSTER 0x7

#define MODE_READ   0x1
#define MODE_WRITE  0x2

#define SEEK_COMMAND          0xF
#define RECALIBRATE_COMMAND   0x7
#define GET_INTERRUPT_STATUS  0x8
#define SPECIFY_COMMAND       0x3
#define READ_COMMAND          0x6

#define SECTORS_PER_TRACK 18
#define NUMBER_OF_HEADS    2

void waitFloppyIrq();
void handleFloppyInterrupt();
int checkInterrupt();
void sendCmdToTheFloppy(unsigned char cmd);
unsigned char readDataFromTheFloppy();
void motorOn();
void motorOff();
void calibrateFloppy();
void initFloppy();
int seekSektor(unsigned char cylinder, unsigned char head);
void programmDMA(int mode_r);
unsigned char* readSector(unsigned char head, unsigned char cylinder, unsigned char track);
unsigned char* readSectorLBA(int lba);

#endif
